package com.ruoyi.common.enums;


import com.ruoyi.common.core.domain.AjaxResult;

/**
 * @author shnejian26@hotmail.com
 * @date 2018/9/28 11:07
 */

public class HjException extends Exception {

    /**
     * 10 - happy_family 错误
     */
    public final static int CC = 100;
    public final static int BASE = 200;

    /**
     * @Fields serialVersionUID :
     */
    private static final long serialVersionUID = 8970523354415436014L;
    private String comment;
    private int code;

    public HjException(String comment) {
        this(comment, 100);
    }

    public HjException(String comment, int code) {
        super();
        this.comment = comment;
        this.code = Long.valueOf(code) < 100 ? 100 : code;
    }


    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }


    public AjaxResult toInvokerResult() {
        return AjaxResult.error(this.code, this.comment);
    }

}